<?php

class Autoloader {
    public $classes = array(
        'Pessoa' => '../../app/models/Pessoa.php',
        'PessoaTable' => '../../app/models/PessoaTable.php',
        'TesteController' => '../../app/controllers/teste/TesteController.php',
        'ApostaController' => '../../app/controllers/aposta/ApostaController.php',
        'ControllerFactory' => '../../app/web/app.php',
        'Autoloader' => '../../MyFrame/Component/Autoloader.php',
        'Router' => '../../MyFrame/Component/Router.php',
        'Kernel' => '../../MyFrame/Component/Kernel.php',
        'Template' => '../../MyFrame/Component/Template.php',
        'Controller' => '../../MyFrame/Component/Controller.php',
        'Request' => '../../MyFrame/Component/Request.php',
        'DB' => '../../MyFrame/Component/Database.php',
        'Database' => '../../MyFrame/Component/Database.php',
        'Record' => '../../MyFrame/Component/Database.php',
    );


    public static $loader;

    public static function init()
    {
        if (self::$loader == NULL)
            self::$loader = new self();

        return self::$loader;
    }

    public function __construct()
    {
        spl_autoload_register(array($this,'load'));
        #spl_autoload_register(array($this,'load2'));
    }

    public function load($class)
    {
        $file = $this->classes[$class];
        require($file);
    }
}

?>
